#include <algorithm>
#include "GameEditorGUI.h"
#include "AIEntityController.h"
#include "SceneGraph.h"
#include "SelectableComponent.h"
#include "RigidBodyComponent.h"
#include "GraphicalComponent.h"
#include "LightNode.h"
#include "SpawnPointBehavior.h"
#include "MinionBehavior.h"
#include "Library.h"

GameEditorGUI::GameEditorGUI(GameEditor* editor) : m_gameEditor(editor)
{
}
// Specific AI Behaviors
void GameEditorGUI::AddSpawnPointBehavior()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
		m_gameEditor->AddSpawnPointBehavior(selected);
	ShowControllerWindow();
}
void GameEditorGUI::AddMinionBehavior()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
		m_gameEditor->AddMinionBehavior(selected);
	ShowControllerWindow();
}
// Entity Functions
void GameEditorGUI::CreateEntity()
{
	m_gameEditor->CreateEntity();

	if (wndSceneGraphDisplay->Visible())
	{
		ShowSceneGraphWindow();
	}
}
void GameEditorGUI::SetEntityGraphic()
{
	const std::string name = cmbModelName->Text();
	Entity* selected = m_gameEditor->getSelected();

	if (selected)
	{
		m_gameEditor->SetEntityGraphic(selected, name);
	}
}
void GameEditorGUI::ShowEntitiesWindow()
{
		unsigned int totalHeight = 0;
	unsigned int counter = 0;

	wndEntityList->Visible(true);
	lstEntityNames->ClearListBoxItems();
	Pointer<GUIListBoxItem> item;

	for (Entity::Map_t::iterator it = Game._getAllEntities().begin(); it != Game._getAllEntities().end(); ++it)
	{
		item = new GUIListBoxItem();
		item->Text(std::string(it->first.getString()));
		item->Dimensions(Maths::Point<unsigned int>(wndEntityList->Dimensions().X-2, 22));
		lstEntityNames->AddListBoxItem(item);
		totalHeight += 22;

		if (it->second.getPointer() == m_gameEditor->getSelected())
			lstEntityNames->Select(counter);

		++counter;
	}
	lstEntityNames->Dimensions(Maths::Point<unsigned int>(wndEntityList->Dimensions().X, totalHeight));
	wndEntityList->Dimensions(Maths::Point<unsigned int>(wndEntityList->Dimensions().X, totalHeight + 44));
	btnEntityDelete->Location(Maths::Point<unsigned int>(btnEntityDelete->Location().X, totalHeight + 2)); 
	btnEntityDeleteCancel->Location(Maths::Point<unsigned int>(btnEntityDeleteCancel->Location().X, totalHeight + 2)); 
}
void GameEditorGUI::SetEntityName()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected && txtEntityName->Text().length() > 0)
	{
		m_gameEditor->SetEntityName(selected, txtEntityName->Text());
	}
}
void GameEditorGUI::SetEntityPosition()
{	
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		float x, y, z;
		
		sscanf_s(txtPositionX->Text().c_str(), "%f", &x);
		sscanf_s(txtPositionY->Text().c_str(), "%f", &y);
		sscanf_s(txtPositionZ->Text().c_str(), "%f", &z);
		
		m_gameEditor->SetEntityPosition(selected, x, y, z);
	}
}
void GameEditorGUI::OnEntityListSelectedChange()
{
	Pointer<GUIListBoxItem> selected = lstEntityNames->Selected();
	if (selected.isValid())
	{
		Entity::Map_t::iterator it = Game._getAllEntities().find(std::string(selected->Text()));
		if (it != Game._getAllEntities().end())
			m_gameEditor->Select(it->second);
	}
}
void GameEditorGUI::DeleteEntityByName()
{
	Pointer<GUIListBoxItem> selected(lstEntityNames->Selected());

	if (selected.isValid())
	{
		m_gameEditor->RemoveEntity(selected->Text());
		m_gameEditor->Select(0);
	}
	ShowEntitiesWindow();
}
void GameEditorGUI::DeleteEntity( Entity* entity )
{
	m_gameEditor->RemoveEntity(entity);
	m_gameEditor->Select(0);
}
void GameEditorGUI::HideEntityWindow()
{
	wndEntityList->Visible(false);
}
void GameEditorGUI::ChangeSelected( Entity* selected )
{
	if (selected)
	{
		this->mnuEntityProperties->Visible(true);
		this->mnuLightProperties->Visible(false);

		OrientationComponent* orientation = (OrientationComponent*)selected->FindComponent(OrientationComponent::type);
		GraphicalComponent* graphical = (GraphicalComponent*)selected->FindComponent(GraphicalComponent::type);
		SelectableComponent* selectable = (SelectableComponent*)selected->FindComponent(SelectableComponent::type);

		char buffer[25];
		sprintf_s(buffer, "%.3f", orientation->getPosition().getObject().X());
		txtPositionX->Text(std::string(buffer));
		sprintf_s(buffer, "%.3f", orientation->getPosition().getObject().Y());
		txtPositionY->Text(std::string(buffer));
		sprintf_s(buffer, "%.3f", orientation->getPosition().getObject().Z());
		txtPositionZ->Text(std::string(buffer));
		
		for (Entity::Map_t::iterator it = Game._getAllEntities().begin(); it != Game._getAllEntities().end(); ++it)
		{
			if (it->second.getPointer() == selected)
			{
				txtEntityName->Text(std::string(it->first.getString()));
				break;
			}
		}

		// Has controller?
		if (m_gameEditor->FindController(selected))
			mitController->Visible(true);
		else
			mitController->Visible(false);

		// Is obstacle?
		// if has obstacle component
	} else
	{
		txtPositionX->DefaultText(std::string("X"));
		txtPositionY->DefaultText(std::string("Y"));
		txtPositionZ->DefaultText(std::string("Z"));
		txtEntityName->Text(std::string(""));
		this->mnuEntityProperties->Visible(false);
	}
}
// AI Functions

void GameEditorGUI::ToggleAddDestination()
{
	m_gameEditor->ToggleAddDestinationFlag();
}
void GameEditorGUI::CreateAI()
{
	if (m_gameEditor->getSelected() && m_gameEditor->FindController() == 0)				// is an entity selected?
	{	
		m_gameEditor->CreateAI();
		ShowControllerWindow();
		m_gameEditor->Select(m_gameEditor->getSelected());
	}
}
void GameEditorGUI::HideAIWindow()
{
	wndToolbox->Visible(true);
	wndAIToolbox->Visible(false);
	wndAIWindow->Visible(false);
}
void GameEditorGUI::ShowControllerWindow()
{
	IEntityController* controller = m_gameEditor->FindController();

	if (!controller)
		return;

	const HashedString& type = controller->Type();

	if (type == AIEntityController::type)
	{
		AIEntityController* ai = (AIEntityController*)controller;

		Pointer<IBehavior> behavior = ai->Behavior();

		if (behavior.isValid())
			lblBehaviorType->Text(std::string(behavior->Type().getString()));
		else 
			lblBehaviorType->Text(std::string(""));
		wndAIToolbox->Visible(true);
		wndAIWindow->Visible(true);
		wndToolbox->Visible(false);
	}
}
void GameEditorGUI::CancelCreateWorld()
{
	wndCreateWorld->Visible(false);
}
void GameEditorGUI::ShowCreateWorldWindow()
{
	wndCreateWorld->Visible(true);
	txtWorldName->Text(std::string(""));
}
void GameEditorGUI::CreateWorld()
{
	wndCreateWorld->Visible(false);
	std::string worldName = txtWorldName->Text();
	m_gameEditor->CreateWorld(worldName);
}
void GameEditorGUI::ShowSetWorldWindow()
{
	wndSetToWorld->Visible(true);
	txtWorldName->Text(std::string(""));
}
void GameEditorGUI::CancelSetWorld()
{
	wndSetToWorld->Visible(false);
}
void GameEditorGUI::SetWorld()
{
	Entity* selected = m_gameEditor->getSelected();
	std::string worldName = txtSetToWorldName->Text();

	if (selected)
	{
		if (m_gameEditor->SetEntityWorld(selected, worldName))
		{
			wndSetToWorld->Visible(false);
		}
	}
}
void GameEditorGUI::DeleteAIBehavior()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		HashedString type(lblBehaviorType->Text());
		AIEntityController* ai = (AIEntityController*)(m_gameEditor->FindController(selected));

		if (ai)
		{
			ai->Behavior(Pointer<IBehavior>(0));
			lblBehaviorType->Text(std::string(" "));
		}
	}
	ShowControllerWindow();
}
// Terrain Functions
void GameEditorGUI::CreateTerrain()
{
	wndCreateTerrain->Visible(false);

	std::string fileName = txtTerrainHeightmapFileName->Text();
	std::string name = txtTerrainName->Text();
	std::string pixelStep = txtTerrainPixelStep->Text();
	std::string textures = txtTerrainTextures->Text();

	// File name and extension
	std::vector<std::string> textureArray;

	unsigned int intPixelStep = atoi(pixelStep.c_str());

	unsigned int index;
	do
	{
		index = textures.find_first_of(';');
		textureArray.push_back(textures.substr(0, index));
		textures.erase(0, index+1);
	} while (index != std::string::npos);

	if (m_gameEditor->CreateTerrain(fileName, name, intPixelStep, textureArray))
		cmbModelName->AddItem(name);
}
void GameEditorGUI::ShowCreateTerrainWindow()
{
	wndCreateTerrain->Visible(true);
	txtTerrainHeightmapFileName->Text(std::string(""));
	txtTerrainName->Text(std::string(""));
	txtTerrainPixelStep->Text(std::string(""));
}
void GameEditorGUI::CancelCreateTerrain()
{
	wndCreateTerrain->Visible(false);
}
// Load and Save Functions
void GameEditorGUI::ShowLoadStateWindow()
{
	wndLoadState->Visible(true);
	txtLoadStateFileName->Text(std::string(""));
}
void GameEditorGUI::ShowSaveStateWindow()
{
	wndSaveState->Visible(true);
	txtSaveStateFileName->Text(std::string(""));
}
void GameEditorGUI::SaveState()
{
	m_gameEditor->SaveGameState(txtSaveStateFileName->Text());
	wndSaveState->Visible(false);
}
void GameEditorGUI::LoadState()
{
	m_gameEditor->LoadGameState(txtLoadStateFileName->Text());
	
	for (Library::ResourcesMap_t::iterator it = Library::getSingleton().getResources().begin(); it != Library::getSingleton().getResources().end(); ++it)
	{
		if (it->first == "Model")
		{
			for (IResource::Map_t::iterator it1 = it->second.begin(); it1 != it->second.end(); ++it1)
			{
				cmbModelName->AddItem(it1->first.getString());
			}
		}
		break;
	}

	wndLoadState->Visible(false);
}
void GameEditorGUI::CancelSaveState()
{
	wndSaveState->Visible(false);
}
void GameEditorGUI::CancelLoadState()
{
	wndLoadState->Visible(false);
}
// Load Model Function
void GameEditorGUI::ShowLoadModelWindow()
{
	wndLoadModel->Visible(true);
	txtModelFileName->Text(std::string(""));
}
void GameEditorGUI::LoadModel()
{
	wndLoadModel->Visible(false);

	// File name and extension
	std::string fileName = txtModelFileName->Text();
	std::string modelName;

	if (m_gameEditor->LoadModel(fileName, modelName))
		cmbModelName->AddItem(modelName);
}
void GameEditorGUI::CancelLoadModel()
{
	wndLoadModel->Visible(false);
}
// Scene Graph
bool RemoveSelectedNode( const Pointer<GUITreeNode>& selected, INode::Vector_t& graph, GUITreeNode::Vector_t& tree )
{
	for (unsigned int i = 0; i < tree.size(); ++i)
	{
		if (tree[i] == selected)
		{
			Pointer<INode> sgNode = graph[i];
			sgNode->Remove();
			return true;
		} else
		{
			if (RemoveSelectedNode(selected, graph[i]->getChildren(), tree[i]->Children()))
				return true;
		}
	}
	return false;
}
Pointer<INode> GetSelectedNode( const Pointer<GUITreeNode>& selected, INode::Vector_t& graph, const GUITreeNode::Vector_t& tree )
{
	for (unsigned int i = 0; i < tree.size(); ++i)
	{
		if (tree[i] == selected)
		{
			Pointer<INode> temp = graph[i];
			return temp;
		} else
		{
			Pointer<INode> temp = GetSelectedNode(selected, graph[i]->getChildren(), tree[i]->Children());
			if (temp.isValid())
				return temp;
		}
	}
	return Pointer<INode>(0);
}
void CreateMenuItemsForNodeVector(GUITreeNode::Vector_t& children, INode::Vector_t& nodes)
{
	Pointer<GUITreeNode> item;

	for (INode::Vector_t::iterator it = nodes.begin(); it != nodes.end(); ++it)
	{
		item = new GUITreeNode();
		item->Title(std::string((*it)->Type().getString()));
		children.push_back(item);
		CreateMenuItemsForNodeVector(item->Children(), (*it)->getChildren());
	}
}
void GameEditorGUI::ShowSceneGraphWindow()
{
	wndSceneGraphDisplay->Visible(true);

	INode::Vector_t& children = SceneGraph::getSingleton().getChildren();
	GUITreeNode::Vector_t& nodes = treSceneGraphNodes->Children();
	treSceneGraphNodes->Children().clear();

	CreateMenuItemsForNodeVector(nodes, children);
}
void GameEditorGUI::HideSceneGraph()
{
	wndSceneGraphDisplay->Visible(false);
}
void GameEditorGUI::DeleteSceneGraphNode()
{
	const Pointer<GUITreeNode> selected(treSceneGraphNodes->Selected());

	INode::Vector_t& children = SceneGraph::getSingleton().getChildren();
	GUITreeNode::Vector_t& nodes = treSceneGraphNodes->Children();

	if (RemoveSelectedNode(selected, children, nodes))
		treSceneGraphNodes->Selected() = 0;

	ShowSceneGraphWindow();
}
void GameEditorGUI::OnSceneNodeChangeSelected()
{
	Pointer<GUITreeNode> selected = treSceneGraphNodes->Selected();
	Pointer<INode> node;
	if (selected == 0)
	{
		this->mnuLightProperties->Visible(false);
	} else
	{
		INode::Vector_t& children = SceneGraph::getSingleton().getChildren();
		GUITreeNode::Vector_t& nodes = treSceneGraphNodes->Children();
		Pointer<INode> node = GetSelectedNode(selected, children, nodes);
		if (node.isValid())
		{
			if (node->Type() == HashedString("LightNode"))
			{
				Pointer<LightNode> light;
				CopyPointer(node, light);
				ShowLightProperties( light );
			}
		}
	}
}
void GameEditorGUI::DragDropSceneGraph()
{
	INode::Vector_t& children = SceneGraph::getSingleton().getChildren();
	GUITreeNode::Vector_t& nodes = treSceneGraphNodes->Children();

	Pointer<GUITreeNode> selected = treSceneGraphNodes->Selected();
	Pointer<GUITreeNode> final = treSceneGraphNodes->FinalDropLocation();

	if (selected == 0 || (selected == final))
		return;
	Pointer<INode> from = GetSelectedNode(selected, children, nodes);
	Pointer<INode> to;
	
	if (from.isValid())
	{
		if (final.isValid())
		{
			to = GetSelectedNode(final, children, nodes);
			from->Remove();
			to->Push_Back(from);
		} else
		{
			from->Remove();
			SceneGraph::getSingletonPtr()->Push_Back(from);
		}
	}
	ShowSceneGraphWindow();
}
// Light Functions
void GameEditorGUI::CreateLight()
{
	m_gameEditor->CreateLight();
	ShowSceneGraphWindow();
}
void GameEditorGUI::SetLightPosition()
{
	Pointer<GUITreeNode> selected = treSceneGraphNodes->Selected();
	if (selected.isValid())
	{
		INode::Vector_t& children = SceneGraph::getSingleton().getChildren();
		GUITreeNode::Vector_t& nodes = treSceneGraphNodes->Children();
		Pointer<INode> node = GetSelectedNode(selected, children, nodes);
		Pointer<LightNode> light;
		CopyPointer(node, light);

		float x, y, z;
		
		sscanf_s(txtLightPositionX->Text().c_str(), "%f", &x);
		sscanf_s(txtLightPositionY->Text().c_str(), "%f", &y);
		sscanf_s(txtLightPositionZ->Text().c_str(), "%f", &z);
		
		m_gameEditor->SetLightPosition(light, x, y, z);
	}
}
void GameEditorGUI::ShowLightProperties( Pointer<LightNode>& light )
{
	this->mnuLightProperties->Visible(true);
	this->mnuEntityProperties->Visible(false);
	char buffer[25];

	sprintf_s(buffer, "%.3f", light->getLight().m_Position[0]);
	txtLightPositionX->Text(std::string(buffer));
	sprintf_s(buffer, "%.3f", light->getLight().m_Position[1]);
	txtLightPositionY->Text(std::string(buffer));
	sprintf_s(buffer, "%.3f", light->getLight().m_Position[2]);
	txtLightPositionZ->Text(std::string(buffer));
}
// RigidBodies
void GameEditorGUI::AddRigidbodyShape()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		std::string strShape(cmbRigidBodyTypes->Text());
		strShape.erase(std::remove_if(strShape.begin(), strShape.end(), isspace), strShape.end());	// Remove spaces
		HashedString shape(strShape);
		
		float x = 0.0f, y = 0.0f, z = 0.0f, radius = 1.0f;
		
		if (txtBodyPositionX->Text().size() > 0)
			sscanf_s(txtBodyPositionX->Text().c_str(), "%f", &x);
		
		if (txtBodyPositionY->Text().size() > 0)
			sscanf_s(txtBodyPositionY->Text().c_str(), "%f", &y);
		
		if (txtBodyPositionZ->Text().size() > 0)
			sscanf_s(txtBodyPositionZ->Text().c_str(), "%f", &z);
		
		m_gameEditor->AddRigidBodyShape(shape, x, y, z);
	}
}
void GameEditorGUI::HideRigidBodyShapes()
{
	wndRigidBodyDisplay->Visible(false);
}
void GameEditorGUI::DeleteAllRigidBodyShapes()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		m_gameEditor->DeleteAllRigidBodyShapes(selected);
		ShowRigidBodyShapes();
	}
}
void GameEditorGUI::DeleteRigidBodyShape()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		if (lstRigidBodyShapes->SelectedRow() != -1)
		{
			m_gameEditor->DeleteRigidBodyShape(selected, lstRigidBodyShapes->SelectedRow());
			ShowRigidBodyShapes();
		}
	}
}
void GameEditorGUI::ShowRigidBodyShapes()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		unsigned int totalHeight = 0;
		std::string type;
		std::string details;

		RigidBodyComponent* rigidbody = (RigidBodyComponent*)selected->FindComponent(RigidBodyComponent::type);
		IShape::Vector_t& shapes = rigidbody->getBody()->getShapes();

		Pointer<GUIListBoxItem> item;
		GUIListBox* listbox = lstRigidBodyShapes;
		listbox->ClearListBoxItems();

		for (IShape::Vector_t::iterator it = shapes.begin(); it != shapes.end(); ++it)
		{
			IShape* shape = (IShape*)(*it);
			type = shape->Type().getString();

			details = (*it)->ToString();

			item = new GUIListBoxItem();
			item->Text(type + "     " + details);
			item->Dimensions(Maths::Point<unsigned int>(wndRigidBodyDisplay->Dimensions().X-2, 22));
			listbox->AddListBoxItem(item);
			totalHeight += 22;
		}
		
		listbox->Dimensions(Maths::Point<unsigned int>(wndRigidBodyDisplay->Dimensions().X, totalHeight));
		wndRigidBodyDisplay->Dimensions(Maths::Point<unsigned int>(wndRigidBodyDisplay->Dimensions().X, totalHeight + 44));
		btnRigidBodyDelete->Location(Maths::Point<unsigned int>(btnRigidBodyDelete->Location().X, totalHeight + 2)); 
		btnRigidBodyCancel->Location(Maths::Point<unsigned int>(btnRigidBodyCancel->Location().X, totalHeight + 2)); 
		btnRigidBodyDeleteAll->Location(Maths::Point<unsigned int>(btnRigidBodyDeleteAll->Location().X, totalHeight + 2));
		
		wndRigidBodyDisplay->Visible(true);
	}
}
// Selectables
void GameEditorGUI::AddSelectablebodyShape()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		std::string strShape(cmbSelectableBodyTypes->Text());
		strShape.erase(std::remove_if(strShape.begin(), strShape.end(), isspace), strShape.end());	// Remove spaces
		HashedString shape(strShape);
		
		float x = 0.0f, y = 0.0f, z = 0.0f, radius = 1.0f;
		
		if (txtBodyPositionX->Text().size() > 0)
			sscanf_s(txtBodyPositionX->Text().c_str(), "%f", &x);
		
		if (txtBodyPositionY->Text().size() > 0)
			sscanf_s(txtBodyPositionY->Text().c_str(), "%f", &y);
		
		if (txtBodyPositionZ->Text().size() > 0)
			sscanf_s(txtBodyPositionZ->Text().c_str(), "%f", &z);
		
		m_gameEditor->AddSelectableBodyShape(shape, x, y, z);
	}
}
void GameEditorGUI::HideSelectableBodyShapes()
{
	wndSelectableBodyDisplay->Visible(false);
}
void GameEditorGUI::DeleteAllSelectableBodyShapes()
{
	Entity* selected = m_gameEditor->getSelected();

	if (selected)
	{
		m_gameEditor->DeleteAllSelectableBodyShapes(selected);
		ShowSelectableBodyShapes();
	}
}
void GameEditorGUI::DeleteSelectableBodyShape()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		if (lstSelectableBodyShapes->SelectedRow() != -1)
		{
			m_gameEditor->DeleteSelectableBodyShape(selected, lstSelectableBodyShapes->SelectedRow());
			ShowSelectableBodyShapes();
		}
	}
}
void GameEditorGUI::ShowSelectableBodyShapes()
{
	Entity* selected = m_gameEditor->getSelected();
	if (selected)
	{
		unsigned int totalHeight = 0;
		std::string type;
		std::string details;

		SelectableComponent* selectable = (SelectableComponent*)selected->FindComponent(SelectableComponent::type);
		IShape::Vector_t& shapes = selectable->getBody()->getShapes();

		Pointer<GUIListBoxItem> item;
		GUIListBox* listbox = lstSelectableBodyShapes;
		listbox->ClearListBoxItems();

		for (IShape::Vector_t::iterator it = shapes.begin(); it != shapes.end(); ++it)
		{
			IShape* shape = (IShape*)(*it);
			type = shape->Type().getString();

			details = (*it)->ToString();

			item = new GUIListBoxItem();
			item->Text(type + "     " + details);
			item->Dimensions(Maths::Point<unsigned int>(wndRigidBodyDisplay->Dimensions().X-2, 22));
			listbox->AddListBoxItem(item);
			totalHeight += 22;
		}
		
		listbox->Dimensions(Maths::Point<unsigned int>(wndRigidBodyDisplay->Dimensions().X, totalHeight));
		wndSelectableBodyDisplay->Dimensions(Maths::Point<unsigned int>(wndRigidBodyDisplay->Dimensions().X, totalHeight + 44));
		btnSelectableBodyDelete->Location(Maths::Point<unsigned int>(btnRigidBodyDelete->Location().X, totalHeight + 2)); 
		btnSelectableBodyCancel->Location(Maths::Point<unsigned int>(btnRigidBodyCancel->Location().X, totalHeight + 2)); 
		btnSelectableBodyDeleteAll->Location(Maths::Point<unsigned int>(btnRigidBodyDeleteAll->Location().X, totalHeight + 2));
		
		wndSelectableBodyDisplay->Visible(true);
	}
}
// Textures
void GameEditorGUI::ShowLoadTextureWindow()
{
	wndLoadTexture->Visible(true);
	txtTextureFileName->Text(std::string(""));
}
void GameEditorGUI::LoadTexture()
{
	wndLoadTexture->Visible(false);

	// File name and extension
	std::string fileName = txtTextureFileName->Text();
	m_gameEditor->LoadTexture(fileName);
}
void GameEditorGUI::CancelLoadTexture()
{
	wndLoadTexture->Visible(false);
}

